package com.lyd.basic;

import java.util.Objects;

/**
 * @Author:lyd
 **/
public class DeepCopyTest {
    public static void main(String[] args) {
        //深拷贝测试
        // 深拷贝会复制整个对象，在堆区中是两个不同的地址值
        Address address = new Address("苏州");
        Person person2 = new Person("李四", 34, address);
        Person person2Copy = person2.clone();
        System.out.println(person2 == person2Copy);
        System.out.println(person2);
        System.out.println(person2Copy);
        System.out.println("=============");
        //修改地址后
        address.setAddressName("成都");
        System.out.println(person2);
        System.out.println(person2Copy);

    }
}
